package com.dapeis.web.admin.controller;

import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

import tk.mybatis.mapper.entity.Example;
import tk.mybatis.mapper.entity.Example.Criteria;

import com.ag.core.base.Pager;
import com.dapeis.core.utils.StylistConstants;
import com.dapeis.domain.Feedback;
import com.dapeis.service.CollocationFeedbackService;

@Controller
@RequestMapping(value = "/admin/collocation/feedback")
public class AdminCollocationFeedbackController extends AdminController {
    @Resource
    CollocationFeedbackService feedbackService;

    @RequestMapping("/list")
    public String userList(
	    @RequestParam(value = "pager", required = false) Pager pager,
	    Map<Object, Object> model, RedirectAttributes attr) {
	if (null == pager) {
	    pager = new Pager();
	}
	Example example = new Example(Feedback.class);
	Criteria criteria = example.createCriteria();
	criteria.andEqualTo(Feedback.PROPERTY_STATE,
		StylistConstants.State.NORMAL);
	example.orderBy(Feedback.PROPERTY_CREATETIME).desc();
	pager.setExample(example);
	feedbackService.pager(pager);
	model.put("pager", pager);
	return doPackageURI("collocation/feedback");
    }
}
